home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1990-11-07 | 10.1 KB | 386 lines |
- ' AMOS Ascii-Reader Link File Creator
- '
- ' By P.J.Hickman
- '
- ' � Copyright 1990 Mandarin Software
- Default
- Screen Close 0
- SET_UP_SCREENS
- 'Set up global variables
- Dim OPTION$(7,1)
- For LOP=0 To 7
- OPTION$(LOP,0)=""
- OPTION$(LOP,1)=""
- Next LOP
- MENU_TITLE$=Space$(60)
- AMOUNT_OF_OPTIONS=0
- FILE_PRESENT=False
- OPTION_FILLED=False
- LINK_FILLED=False
- 'Global variables for alert box
- Dim LINE$(5),BUTTON$(3)
- On Menu Proc MENU_1,MENU_2
- 'Main loop
- Repeat
- On Menu On
- CHECK_MOUSE
- POSITION=Param
- If FILE_PRESENT
- If POSITION=1
- MENU_TITLE_INPUT
- End If
- If POSITION>=2 and POSITION<=9 and AMOUNT_OF_OPTIONS>=POSITION-2
- OPTION_INPUT[POSITION-2]
- End If
- End If
- Until False
- Procedure CHECK_MOUSE
- Repeat
- On Menu On
- CLICK=Mouse Click
- POS=Mouse Zone
- Until CLICK and POS>0 and Mouse Key=1
- End Proc[POS]
- Procedure DISPLAY_MENU
- Shared MENU_TITLE$,OPTION$(),AMOUNT_OF_OPTIONS
- Cls 0,0,20 To 640,200
- For LOP=0 To 15 Step 2
- Print At(14,LOP+5);(LOP/2)+1;At(14,LOP+5);"[";At(16,LOP+5);"] ";OPTION$(LOP/2,0)
- Next LOP
- End Proc
- Procedure CREATE_LINK_FILE
- Shared OPTION$(),MENU_TITLE$,AMOUNT_OF_OPTIONS,FILE_PRESENT,FILE$
- Screen 2
- Cls 0
- Pen 1
- FILE$=""
- For LOP=0 To 7
- OPTION$(LOP,0)=""
- OPTION$(LOP,1)=""
- Next LOP
- MENU_TITLE$=""
- AMOUNT_OF_OPTIONS=0
- Centre At(,9)+"Please type the name of your new menu."
- CUSTOM_INPUT[60,8,11,1,1,0,32,127,True]
- MENU_TITLE$=Param$
- Print At(,9);Space$(80);
- DISPLAY_OPTION[0]
- OPTION_TITLE_INPUT[0]
- OPTION_LINK_INPUT[0]
- Inc AMOUNT_OF_OPTIONS
- DISPLAY_MENU
- FILE_PRESENT=True
- End Proc
- Procedure LINK_FILE_SAVE[TYPE]
- Shared AMOUNT_OF_OPTIONS,MENU_TITLE$,OPTION$(),FILE$
- Shared LINE$(),BUTTON$()
- On Error Goto FATEL_ERROR1
- If(TYPE=1 and Asc(FILE$)=0) or TYPE=2
- FILE$=Fsel$("*.Lnk","","Please choose a save name")
- End If
- If AMOUNT_OF_OPTIONS<7 Then Dec AMOUNT_OF_OPTIONS
- IDTAG$="AARLFBYPJH"
- IDTAG2$="END OF FILE!"
- Open Out 1,FILE$
- Print #1,IDTAG$
- Print #1,MENU_TITLE$
- Print #1,Str$(AMOUNT_OF_OPTIONS)
- For LOP=0 To AMOUNT_OF_OPTIONS
- Print #1,OPTION$(LOP,0)
- Print #1,OPTION$(LOP,1)
- Next LOP
- Print #1,IDTAG2$
- RECOVER_1:
- Close
- Pop Proc
- FATEL_ERROR1:
- If FILE$<>""
- For LOP=1 To 5
- Bell
- Wait 2
- Next LOP
- LINE$(0)="Woops, disc error!"
- BUTTON$(0)="Never mind."
- ALERT[21,7,0,1,1,1]
- End If
- Resume RECOVER_1
- End Proc
- Procedure LINK_FILE_LOAD
- Shared FILE_PRESENT,FILE$,AMOUNT_OF_OPTIONS,MENU_TITLE$,OPTION$()
- Shared LINE$(),BUTTON$()
- On Error Goto FATEL_ERROR2
- Repeat
- FILE$=Fsel$("*.Lnk","","Please choose a file to load")
- Until Exist(FILE$)
- Open In 1,FILE$
- Input #1,TAGID$
- If TAGID$<>"AARLFBYPJH"
- Bell
- Print "tag wrong:";TAGID$
- Pop Proc
- End If
- Input #1,MENU_TITLE$
- Input #1,TEMP$
- AMOUNT_OF_OPTIONS=Val(TEMP$)
- For LOP=0 To AMOUNT_OF_OPTIONS
- Input #1,OPTION$(LOP,0)
- Input #1,OPTION$(LOP,1)
- Next LOP
- FILE_PRESENT=True
- If AMOUNT_OF_OPTIONS<7 Then Inc AMOUNT_OF_OPTIONS
- MENU_TITLE_PRINT
- DISPLAY_MENU
- RECOVER_2:
- Close
- Pop Proc
- FATEL_ERROR2:
- If FILE$<>""
- For LOP=1 To 5
- Bell
- Wait 2
- Next LOP
- LINE$(0)="Woops, disc error!"
- BUTTON$(0)="Never mind."
- ALERT[21,7,0,1,1,1]
- End If
- Resume RECOVER_2 :
- End Proc
- Procedure DISPLAY_OPTION[NUM]
- Shared OPTION$(),MENU_TITLE$
- Cls 0
- Print At(0,0);Space$(80);At(0,1);Space$(80);
- Centre At(,1)+MENU_TITLE$
- For LOP=1 To Len(MENU_TITLE$)+2
- TEMP$=TEMP$+"~"
- Next LOP
- Centre At(,2)+TEMP$
- Print At(0,5);Space$(80)
- Centre At(,5)+Border$("MENU OPTION"+Str$(NUM+1),1)
- Print At(2,9);" Option title: [ ";OPTION$(NUM,0);Space$(40-Len(OPTION$(NUM,0)));At(60,9);"]"
- Print At(2,11);"Link filename: [ ";Left$(OPTION$(NUM,1),40);Space$(40-Min(40,Len(OPTION$(NUM,1))));At(60,11);"]"
- End Proc
- Procedure OPTION_INPUT[NUM]
- Shared OPTION$(),MENU_TITLE$,AMOUNT_OF_OPTIONS,FILE_PRESENT
- DISPLAY_OPTION[NUM]
- Centre At(,20)+Border$("RETURN TO MAIN MENU",1)
- Repeat
- CHECK_MOUSE
- POSITION=Param
- If POSITION=1 Then MENU_TITLE_INPUT
- If POSITION=4 Then OPTION_TITLE_INPUT[NUM]
- If POSITION=5 Then OPTION_LINK_INPUT[NUM]
- If OPTION$(NUM,0)<>"" Then OPTION_FILLED=True
- If OPTION$(NUM,1)<>"" Then LINK_FILLED=True
- Until(OPTION_FILLED=True and LINK_FILLED=True and POSITION=10) or(OPTION_FILLED=False and LINK_FILLED=False and POSITION=10)
- FILE_PRESENT=True
- If AMOUNT_OF_OPTIONS<7 and OPTION_FILLED and LINK_FILLED and NUM>AMOUNT_OF_OPTIONS-1 Then Inc AMOUNT_OF_OPTIONS
- DISPLAY_MENU
- End Proc
- Procedure MENU_TITLE_INPUT
- Shared MENU_TITLE$
- Print At(0,2);Space$(80);
- CUSTOM_INPUT[60,10,1,1,1,0,32,127,True]
- MENU_TITLE$=Param$
- MENU_TITLE_PRINT
- End Proc
- Procedure MENU_TITLE_PRINT
- Shared MENU_TITLE$
- Centre At(,1)+MENU_TITLE$
- For LOP=1 To Len(MENU_TITLE$)+2
- TEMP$=TEMP$+"~"
- Next LOP
- Centre At(,2)+TEMP$
- End Proc
- Procedure OPTION_TITLE_INPUT[NUM]
- Shared OPTION$()
- CUSTOM_INPUT[40,19,9,1,1,0,32,127,False]
- OPTION$(NUM,0)=Param$
- End Proc
- Procedure OPTION_LINK_INPUT[NUM]
- Shared OPTION$()
- Repeat
- Repeat
- OPTION$(NUM,1)=Fsel$("*.*","","Pick file to link")
- Until OPTION$(NUM,1)<>""
- Until Exist(OPTION$(NUM,1))
- TEMP=Len(OPTION$(NUM,1))-4
- OPTION$(NUM,1)=Right$(OPTION$(NUM,1),TEMP)
- Print At(2,11);"Link filename: [ ";Left$(OPTION$(NUM,1),40);Space$(40-Min(40,Len(OPTION$(NUM,1))));At(60,11);"]"
- End Proc
- Procedure SET_UP_SCREENS
- Screen Open 2,640,200,2,Hires
- Colour 1,$CCC
- Curs Off : Flash Off : Cls 0
- Reserve Zone 15
- Print At(0,1);Zone$(Space$(79),1)
- For LOP=0 To 15
- Print At(0,LOP+4);Zone$(Space$(79),(LOP/2)+2)
- Next LOP
- Print At(0,20);Zone$(Space$(79),10)
- Centre At(,5)+"AMOS Link File Creator"
- Centre At(,6)+"~~~~~~~~~~~~~~~~~~~~~~~~"
- Centre At(,8)+"By P.J.Hickman"
- Inverse On
- Centre At(,11)+"Click the right mouse button to display menu."
- Inverse Off
- 'Set up menu
- Menu$(1)=" AMOS "
- Menu$(1,1)=" About "
- Menu$(1,2)="-------" : Menu Inactive(1,2)
- Menu$(1,3)=" Quit "
- Menu$(2)=" Edit "
- Menu$(2,1)=" Create Link File "
- Menu$(2,2)="------------------" : Menu Inactive(2,2)
- Menu$(2,3)=" Load Link File "
- Menu$(2,4)="------------------" : Menu Inactive(2,4)
- Menu$(2,5)=" Save Link File "
- Menu$(2,6)=" Save As....... "
- Menu$(2,7)="------------------" : Menu Inactive(2,7)
- Menu$(2,8)=" Print Link File "
- Menu On
- Repeat : Until Mouse Click
- End Proc
- Procedure MENU_1
- Shared POSITION,LINE$(),BUTTON$()
- If Choice(2)=1
- LINE$(0)="Link File Creator"
- LINE$(1)="~~~~~~~~~~~~~~~~~"
- LINE$(2)=""
- LINE$(3)=" By P.J.Hickman"
- BUTTON$(0)="Have Fun!!!!"
- ALERT[23,9,0,1,1,4]
- End If
- If Choice(2)=3
- Default
- End
- End If
- On Menu On
- End Proc
- Procedure MENU_2
- Shared FILE_PRESENT,POSITION
- If Choice(2)=1 Then CREATE_LINK_FILE
- If Choice(2)=3 Then LINK_FILE_LOAD
- If Choice(2)=5 Then LINK_FILE_SAVE[1]
- If Choice(2)=6 Then LINK_FILE_SAVE[2]
- If Choice(2)=8 and FILE_PRESENT Then LINK_FILE_PRINT
- On Menu On
- End Proc
- Procedure LINK_FILE_PRINT
- Shared OPTION$(),MENU_TITLE$,AMOUNT_OF_OPTIONS
- Shared LINE$(),BUTTON$()
- On Error Goto FATEL_ERROR3
- Menu Off
- Lprint MENU_TITLE$
- For LOP=1 To Len(MENU_TITLE$)
- Lprint "~";
- Next LOP
- Lprint : Lprint
- If AMOUNT_OF_OPTIONS<7 Then Dec AMOUNT_OF_OPTIONS
- For LOP=0 To AMOUNT_OF_OPTIONS
- Lprint "OPTION NUMBER:";LOP+1
- Lprint "OPTION TITLE: ";OPTION$(LOP,0)
- Lprint "LINKED FILE: ";OPTION$(LOP,1)
- Lprint : Lprint : Lprint
- Next LOP
- RECOVER_3:
- If AMOUNT_OF_OPTIONS<7 Then Inc AMOUNT_OF_OPTIONS
- Menu On
- Pop Proc
- FATEL_ERROR3:
- For LOP=1 To 5
- Bell
- Wait 2
- Next LOP
- LINE$(0)="There is a Printer problem!"
- BUTTON$(0)="Sorry about that"
- ALERT[32,7,0,1,1,1]
- Resume RECOVER_3
- End Proc
- Procedure CUSTOM_INPUT[INPSIZE,X,Y,TCOL,CURSCOL,PAPCOL,SKEY,EKEY,RID]
- Menu Off
- INP$=""
- COUNT=0
- SCANPRESS=0
- X2=X
- Paper PAPCOL
- Print At(X,Y);Space$(INPSIZE+1);
- Print At(X-2,Y);"[";At(X+INPSIZE+1,Y);"]"
- Clear Key
- Repeat
- Locate X2,Y
- Pen CURSCOL : Print "_" : Pen TCOL
- Locate X2,Y
- Repeat
- KEY_GET
- PRESSKEY$=Param$
- SCANPRESS=Scancode
- Until(Asc(PRESSKEY$)>=SKEY and Asc(PRESSKEY$)<=EKEY) or SCANPRESS=65 or SCANPRESS=68
- ' If SCANPRESS<>65 and COUNT>0 and SCANPRESS<>68 Then PRESSKEY$=Lower$(PRESSKEY$)
- If SCANPRESS<>65 and COUNT<INPSIZE and SCANPRESS<>68
- Print PRESSKEY$
- INP$=INP$+PRESSKEY$
- Inc COUNT
- Inc X2
- End If
- If SCANPRESS=65 and X2>X and SCANPRESS<>68
- Dec COUNT
- Dec X2
- Locate X2,Y
- Print " ";
- INP$=Left$(INP$,COUNT)
- End If
- Until SCANPRESS=68 and COUNT>0
- Print At(X2,Y);" "
- Clear Key
- If RID
- Print At(X-2,Y);Space$(INPSIZE+4);
- End If
- Menu On
- End Proc[INP$]
- Procedure KEY_GET
- Repeat
- PRESSKEY$=Inkey$
- Until PRESSKEY$<>""
- End Proc[PRESSKEY$]
- Procedure PAUSE[NUM]
- For LOP=1 To NUM
- Next
- End Proc
- 'Aaron Fothergill's (slightly altered to work in hires) Alert Box
- '(Uses ZONE's 11+ and returns the button number as a PARAM)
- Procedure ALERT[W,H,BACK_COL,LINE_COL,NB,NL]
- Shared LINE$(),BUTTON$()
- Menu Off
- TEMP=0
- W=W*8
- H=H*8
- X=(Screen Width/2)-W/2
- Y=10
- Get Block 241,0,Y-2,Screen Width,H+6
- Ink BACK_COL
- Bar X,Y-2 To X+W,Y+H
- Ink LINE_COL
- Box X+1,Y-2 To X+W-1,Y+H-1
- S=W/8/(NB+1)+1
- Paper BACK_COL
- Pen LINE_COL
- For LOP=0 To NL
- Locate 0,Y Text(Y)+1+LOP
- Centre LINE$(LOP)
- Next LOP
- TEMP=0
- While TEMP<>NB
- Locate X Text(X)+S/2+S*TEMP,Y Text(Y+H)-2
- Print Border$(Zone$(BUTTON$(TEMP),TEMP+11),2);
- Inc TEMP
- Wend
- TEMP=0
- Repeat
- Repeat : Until Mouse Click and Mouse Key=1
- TEMP=Mouse Zone
- Until TEMP=>10
- Put Block 241,0,Y-2
- Del Block 241
- Add TEMP,-10
- Menu On
- End Proc[TEMP]